﻿
			
		<!-- Main Content -->
		<div class="span-19 last" id="content">
			<table class="span-16 last" border="1" style="margin-left:20px; margin-right:auto; margin-top:40px">
				  <tr>
					<td width="200"><div align="center"><strong><span class="Arial">วัน-เดือน-ปี</span></strong></div></td>
					<td width="180"><div align="center"><strong><span class="Arial">ชื่อยา</span></strong></div></td>
					<td width="180"><div align="center"><strong><span class="Arial">ช่วง</span></strong></div></td>
					<td width="130"><div align="center"><strong><span class="Arial">เวลา</span></strong></div></td>
					<td width="180"><div align="center"><strong><span class="Arial">รายละเอียด</span></strong></div></td>
					<td width="180"><div align="center"><strong><span class="Arial">เหลือ</span></strong></div></td>
				  </tr>
			<?php if($med): ?>
				<?php $id = 0; ?>
				<?php $date = ""; ?>
				<?php $count = 0; ?>
				<?php foreach($med as $m): ?>
				<?php $count += $m->count*$m->dose; ?>
				<?php $mid = $m->med_id; ?>
				<?php if($mid != $id): ?>
				<?php $id = $m->med_id;?>
				<tr>
					<td><div align="center"><?php echo $m->date; ?></div></td>
					<td><div align="center"><?php echo $m->med_name.'<br/>'. $m->type; ?></div></td>
					<td><div align="center"><?php echo $m->routine; ?></div></td>
					<td><div align="center"><?php echo $m->time; ?></div></td>
					<td><div align="center">
					<?php switch($m->count){
							case 0 : echo "ไม่กิน"; break;
							case 1 : echo "กินตามเวลา"; break;
							case 2 : echo "ไม่มีข้อมูล"; break;
					} ?>
					</div></td>
					<td><div align="center"><?php echo $m->total; ?></div></td>
				</tr>
				<?php else: ?>
				<tr>
					<td><div align="center"></div></td>
					<td><div align="center"></div></td>
					<td><div align="center"></div></td>
					<td><div align="center"><?php echo $m->time; ?></div></td>
					<td><div align="center">
					<?php switch($m->count){
							case 0 : echo "ไม่กิน"; break;
							case 1 : echo "กินตามเวลา"; break;
							case 2 : echo "ไม่มีข้อมูล"; break;
					} ?>
					</div></td>
					<td><div align="center"><?php echo $m->total; ?></div></td>
				</tr>
				<?php endif; ?>
				<?php endforeach; endif; ?>
			</table>
		</div>
		
		
		
	</div>
	

